import request from '@/api/request'
import { ResponseFormat, ResponseFormatWithList, IPaginationFormWithCondition } from '#/http'
import { IMenu } from '@/types/systemManage'

// 菜单列表-全部
export const getMenuListAllAPI = (body: IPaginationFormWithCondition): Promise<ResponseFormatWithList> => {
  return request.post('menu/getMenus', body)
}

// 菜单列表-children
export const getMenuListChildrenAPI = (body: any): Promise<ResponseFormat<any[]>> => {
  return request.post('menu/getMenusChildren', body)
}

// 新增菜单
export const createMenuAPI = (data: IMenu): Promise<ResponseFormatWithList> => {
  return request.post('menu/create', data)
}

// 删除菜单
export const deleteMenuAPI = (id: number): Promise<ResponseFormat> => {
  return request.delete(`menu/delete/${id}`)
}
// 更新菜单
export const updateMenuAPI = (data: IMenu): Promise<ResponseFormatWithList> => {
  return request.post('menu/update', data)
}
